package com.duying.gh.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.busi.framework.base.BaseDao;
import com.duying.gh.model.Unit;

public class UnitDao extends BaseDao{
	public Class getEntityClass(){
		return Unit.class;
	}
	
	 
	public Unit getUnitByUnitName(String unitName){
		String hql = "from Unit u where u.unit_name =:unit_name";
		Map map = new HashMap();
		map.put("unit_name", unitName);
		List listUnit = super.getByHQL(hql, map);
		if(listUnit.isEmpty()){
			return null;
		}else{
			return (Unit)listUnit.get(0);
		}
		
	}
}
